using IM.Easy.Entity.Scheduled;
using IM.Easy.Infrastructure.Query;
using SqlSugar;
using System.ComponentModel.DataAnnotations;


namespace IM.Easy.ScheduledServices.Dtos
{
    /// <summary>
    /// 作业历史记录查询实体
    /// </summary>
    public class JobExecutionHistoryQueryDto : QueryBase
    {
        /// <summary>
        /// 作业名（模糊查询）
        /// </summary>
        public string JobName { get; set; }

        /// <summary>
        /// 作业结果（true=成功，false=失败，null=全部）
        /// </summary>
        public bool? Success { get; set; }
    }

    /// <summary>
    /// 作业历史记录dto
    /// </summary>
    public class JobExecutionHistoryDto
    {
        /// <summary>
        /// 
        /// </summary>
        public Guid HistoryId { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public Guid JobId { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public Guid TriggerId { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public DateTime StartTime { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public DateTime? EndTime { get; set; }


        /// <summary>
        /// 耗时（ms）
        /// </summary>
        public long Duration { get; set; }


        /// <summary>
        /// 执行编码
        /// </summary>
        public string FireInstanceId { get; set; }

        /// <summary>
        /// 错误消息
        /// </summary>
        public string ErrorMessage { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreatedAt { get; set; }
        /// <summary>
        /// 创建人
        /// </summary>
        public long CreatedBy { get; set; }
        /// <summary>
        /// 最后更新人
        /// </summary>
        public long UpdatedBy { get; set; }
        /// <summary>
        /// 最后更新时间
        /// </summary>
        public DateTime? UpdatedAt { get; set; }
        /// <summary>
        /// 删除状态
        /// </summary>
        public bool IsDeleted { get; set; }
        /// <summary>
        /// 删除人
        /// </summary>
        public long DeletedBy { get; set; }
        /// <summary>
        /// 删除时间
        /// </summary>
        public DateTime? DeletedAt { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public bool Success { get; set; }

        /// <summary>
        /// 关联任务
        /// </summary>
        public ScheduledJob Job { get; set; }
    }
}
